package com.fxkj.cloud.drms.infra.mq.mqtt.sender;

import lombok.Getter;

/**
 * <p>description: </p>
 * @author ww
 * @date 2025/4/2 15:04
 */
@Getter
public enum MqttMessageType {
    COMMAND(0, "指令下发"),
    QUERY(1, "查询指令"),
    ;
    private final Integer code;
    private final String description;

    MqttMessageType(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public static MqttMessageType of(Integer code) {
        for (MqttMessageType type : MqttMessageType.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}
